package doyouknow.group.CnAndZhb.error;

/**
 * Created by a10.13.6 on 2019/4/23.
 */
public class BusinessException extends Exception implements CommonError{

    private CommonError commonError;


    //直接结束EnumBusinessError的传参，用于构造业务异常
    public BusinessException(CommonError commonError) {
        super();
        this.commonError = commonError;
    }

    public BusinessException(CommonError commonError,String errorMsg) {
        super();
        this.commonError = commonError;
        this.commonError.setErrorMsg(errorMsg);
    }

    @Override
    public int getErrorCode() {
        return commonError.getErrorCode();
    }

    @Override
    public String getErrorMsg() {
        return commonError.getErrorMsg();
    }

    @Override
    public EnumBusinessError setErrorMsg(String errorMsg) {
        return commonError.setErrorMsg(errorMsg);
    }
}
